import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
import { viteSingleFile } from 'vite-plugin-singlefile';

// https://vite.dev/config/
export default defineConfig(({ mode }) => {
  const isDevelopment = mode === "development";
  return {
    base: isDevelopment ? '/' : './', // 生产环境下使用相对路径
    plugins: [vue(),viteSingleFile()],
    build: {
      outDir: 'dist', // 指定输出目录
      emptyOutDir: true,
    },
    server: {
      port: 3000, // 开发服务器端口
    },
    resolve: {
      alias: {
        "@": resolve(__dirname, "./src"),
      },
    },
  };
});
